package com;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test {

    public static void main(String args[]) {


        // 按指定模式在字符串查找
        String line = "http://www.game.com/game/61/fsf";
        String pattern = String.format("(%s|%s)\\/\\d+",
                "game", "special");

        // 创建 Pattern 对象
        Pattern r = Pattern.compile(pattern);

        // 现在创建 matcher 对象
        Matcher m = r.matcher(line);
        int number = m.groupCount();
        while (m.find()) {
            System.out.println("Found value: " + m.group());
//            System.out.println("Found value: " + m.group(1) );
//            System.out.println("Found value: " + m.group(2) );

            String[] split = m.group().split("\\/");

            System.out.println("Found value: " + split[1]);


        }/* else {
            System.out.println("NO MATCH");
        }*/

    }

}
